<nz-modal [(nzVisible)]="isVisible" [nzMaskClosable]="false"
  [nzTitle]="notificationInformationDTO.id ? '通知信息' : '新增通知信息'" (nzOnCancel)="handleCancel()" [nzFooter]="detailFooter"
  nzWidth="400">

  <form nz-form [formGroup]="validateForm" #myForm="ngForm">
    <nz-form-item>
      <nz-form-label nzRequired [nzSpan]="6" nzFor="title">通知标题</nz-form-label>
      <nz-form-control [nzSpan]="14" nzHasFeedback nzValidatingTip="验证中..." [nzErrorTip]="titleErrorTpl">
        <input nz-input formControlName="title" [(ngModel)]="notificationInformationDTO.title" placeholder="通知标题必填"
          *ngIf="!isPreView; else titleTemp">
        <ng-template #titleErrorTpl let-control>
          <ng-container *ngIf="control.hasError('required')">
            请输入通知标题!
          </ng-container>
        </ng-template>
        <ng-template #titleTemp>
          <div class="editable-cell">
            <div class="editable-cell-value-wrap text-truncate">
              {{ notificationInformationDTO?.title }}
            </div>
          </div>
        </ng-template>
      </nz-form-control>
    </nz-form-item>
    <nz-form-item>
      <nz-form-label nzRequired [nzSpan]="6" nzFor="type">通知类型</nz-form-label>
      <nz-form-control [nzSpan]="14" nzHasFeedback nzValidatingTip="验证中..." [nzErrorTip]="typeErrorTpl">
        <input nz-input formControlName="type" [(ngModel)]="notificationInformationDTO.type" placeholder="通知类型必填"
          *ngIf="!isPreView; else typeTemp">
        <ng-template #typeErrorTpl let-control>
          <ng-container *ngIf="control.hasError('required')">
            请输入通知类型!
          </ng-container>
        </ng-template>
        <ng-template #typeTemp>
          <div class="editable-cell">
            <div class="editable-cell-value-wrap text-truncate">
              {{ notificationInformationDTO?.type }}
            </div>
          </div>
        </ng-template>
      </nz-form-control>
    </nz-form-item>
    <nz-form-item>
      <nz-form-label nzRequired [nzSpan]="6" nzFor="receiverName">通知对象</nz-form-label>
      <nz-form-control [nzSpan]="14">
        <div class="editable-cell">
          <div class="editable-cell-value-wrap text-truncate">
            {{ notificationInformationDTO?.receiverName }}
          </div>
        </div>
      </nz-form-control>
    </nz-form-item>
    <nz-form-item>
      <nz-form-label nzRequired [nzSpan]="6" nzFor="date">创建时间</nz-form-label>
      <nz-form-control [nzSpan]="14">
        <div class="editable-cell">
          <div class="editable-cell-value-wrap text-truncate">
            {{ notificationInformationDTO?.date | date: 'yyyy-MM-dd'}}
          </div>
        </div>
      </nz-form-control>
    </nz-form-item>
    <nz-form-item>
      <nz-form-label nzFor="content" [nzSpan]="6">通知内容</nz-form-label>
      <nz-form-control [nzSpan]="14">
        <textarea nz-input rows="3" autocomplete="off" [(ngModel)]="notificationInformationDTO.content"
          formControlName="content" placeholder="通知内容" *ngIf="!isPreView; else contentTemp"></textarea>
        <ng-template #contentTemp>
          <div class="editable-cell">
            <div class="editable-cell-value-wrap text-truncate">
              {{ notificationInformationDTO?.content }}
            </div>
          </div>
        </ng-template>
      </nz-form-control>
    </nz-form-item>
    <nz-form-item>
      <nz-form-label [nzSpan]="6" nzFor="teacherName"><span>
          通知附件
          <i nz-icon nz-tooltip nzTitle="通知的加分文件" style="color: red;" nzType="question-circle" nzTheme="outline"></i>
        </span></nz-form-label>
      <nz-form-control [nzSpan]="14">
        <button nz-button nzType="primary" (click)="uploadAttach('通知文件', notificationInformationDTO?.files)">
          <i nz-icon nzType="plus" nzTheme="outline"></i>通知文件
        </button>
      </nz-form-control>
    </nz-form-item>
  </form>

  <app-attach-small #attachSmallComponent [attachFiles]="attachFiles" [attachType]="fileType" [isShow]="isShow"
    [readOnly]="isReview" (result)="resultChange($event)"></app-attach-small>

  <ng-template #detailFooter>
    <button nz-button nzType="primary" (click)="save()" *ngIf="!isPreView" [nzLoading]="loading">
      <span>保存</span>
    </button>
    <button nz-button nzType="primary" (click)="complite()" *ngIf="isConfirm"
      [disabled]="notificationInformationDTO.isConfirm">确认已读</button>
    <button nz-button nzType="default" (click)="handleCancel()">关闭</button>
  </ng-template>
</nz-modal>
